1 from utils import (
2     get_products,
3     select_by_id_or_name,
4     safe_input,
5     update_products
6 )
7
8
9 def register_product_arrival():
10     print(
"--- Register product arrival ---\n")
11     print(
"Which product is it?")
12
13     menu = get_products()
14
15     
for thing in menu:
16         print(thing[
'name'], thing['id'])
17
18     chooosen_product = select_by_id_or_name(menu,
'product')
19
20     arrival_quantity = safe_input(
'int_positive', 'Recent arrival quantity:')
21
22     chooosen_product[
'quantity'] += arrival_quantity
23
24     print(
'OKAY. You\'ve registered %s items of %s product' %
25           (arrival_quantity, chooosen_product[
'name']))
26     print(
'Now there are %s in stock' % chooosen_product['quantity'])
27     update_products(menu)


Gõ tìm kiếm nhanh...